import re


def check_username(username: str) -> bool:
    if type(username) != str:
        return False

    if len(username) < 2 or len(username) > 20:
        return False

    if not re.fullmatch('[a-zA-Z0-9_]*', username):
        return False

    return True


def check_password(password: str) -> bool:
    if type(password) != str:
        return False

    if len(password) < 2 or len(password) > 20:
        return False

    if not re.fullmatch('[a-zA-Z0-9_@!]*', password):
        return False

    return True
